//Manager.h
#ifndef Manager_H
#define Manager_H

#include "list.h"
#include "synch.h"
#include <stdarg.h>

class Cineplex;

class Manager
{
	public:
		Manager(char* name);
		~Manager();
		void SendMessage(char* name, int argc, ...);
		void SendMessage(char* name, IterList* args);
		void Scheduler();
		void Start();
		
		void CT4();
		
		//actions
		void IdleAction();
		void AvailAction();
		void StartMovie();
		void DecideCC();
		void BackToCheck();
		void BackToCash();
		void ChATC();
		void ChWTC();
		void ChHTC();
		void ChSTC();
		void ChAFC();
		void ChWFC();
		void ChHFC();
		void ChSFC();
		void ChATT();
		void ChWTT();
		void ChHTT();
		void ChSTT();
		void CaATC();
		void CaWTC();
		void CaAFC();
		void CaWFC();
		void CaCTT();
		
		MsgList* msgList;
		MsgList* outgoing;
		void* replyTo;
		Lock* msgLock;
		char* myName;
		Condition* sleepCon;
		char* state;
		
		Cineplex* cinema;
		IterList* clerks;
		IterList* checkQueue;
		IterList* currentGroup;
		IterList* lineLengths;
		int numTixClerks, numFoodClerks, numTixTakers, msgsToSend, repliesWaiting;
		/*bools*/ int moviePlaying, checkLoop, cashLoop;
		float tixCash, foodCash;
};


#endif
